<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
  <!--引入Vue-->
  <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<div class="root">
<!--  v-for可以遍历数组,遍历对象,甚至遍历字符串,或者遍历指定的次数-->
  <ul>
    <li v-for="(person,index) in persons" :key="person.id">
      {{ person.name }}-{{ person.age }}-{{index}}
    </li>
  </ul>
  <ul>
    <li v-for="(value,key) of car" :key="key">
      {{key}}-{{value}}
    </li>
  </ul>
</div>
</body>

<script type="text/javascript">
  new Vue({
    el: '.root',
    data: {
      persons: [
        {id: '001',name: '张三',age: 18},
        {id: '002',name: '张四',age: 14},
        {id: '003',name: '张五',age: 15},
      ],
      car: {
        name: '奥迪A8',
        price: '70w',
        color: '黑色'
      }
    }
  })
</script>
</html>
